package homework9.Convert;

import org.apache.struts2.util.StrutsTypeConverter;

import java.util.HashMap;
import java.util.Map;

public class MapTest extends StrutsTypeConverter {
    Map<String, String> stringMap = new HashMap<>();
    @Override
    public Object convertFromString(Map map, String[] strings, Class aClass) {
        String s = "小学:文化路小学,中学:郑州中学";
        String[] maps = strings[0].split(",");
        for (String string : maps) {
            stringMap.put(string.split(":")[0], string.split(":")[1]);
        }
        return stringMap;
    }

    @Override
    public String convertToString(Map map, Object o) {
        stringMap= (Map<String, String>) o;
        return null;
    }
}
